# Maintainer: Justin Kromlinger <hashworks@archlinux.org>
pkgname=kiwix-lib
pkgver=9.4.1
pkgrel=6
pkgdesc="Library providing the Kiwix software core"
license=('GPL3')
arch=('loong64' 'x86_64')
depends=('libzim6' 'pugixml' 'mustache' 'xapian-core' 'aria2' 'libmicrohttpd' 'python' 'curl')
makedepends=('meson' 'gtest')
url='https://github.com/kiwix/kiwix-lib'
source=("libkiwix-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz")
sha256sums=('58c5fe6742f7f14cdda6bcdca29b8960891a4e9094ec10a48e1aa9b0a8f03ee5')

build() {
	cd "libkiwix-${pkgver}"
	# We want to ignore xapian ABI version mismatches
	arch-meson build -Dwerror=false
	ninja -C build
}

check() {
	cd "libkiwix-${pkgver}/build"
	ninja meson-test
}

package() {
	install -Dm644 "libkiwix-${pkgver}/COPYING" "$pkgdir/usr/share/licenses/$pkgname/COPYING"
	cd "libkiwix-${pkgver}/build"
	DESTDIR="${pkgdir}" ninja install
}
